// 广告页

require('../css/adv.less');



// 倒计时

document.ready(function () {

    let time = document.querySelector('.time');
    let skip = document.querySelector('.a-skip');


    let count = Number.parseInt(time.innerHTML)


    let timer = setInterval(function () {
        count--

        if (count == 0) {
            clearInterval(timer)
            location.href = "./login.html"
            return
        }
        time.innerHTML = count
    }, 1000)


    skip.addEventListener('click', function () {
        clearInterval(timer)
        location.href = "./login.html"
    })



    // 判断是否登入,如果登入了直接去首页

      if (localStorage.getItem('data')) {
          const data = JSON.parse(localStorage.getItem('data'));
          if (!data.token) {
              location.href = "./index.html"
          }
      }

     




})